#include<iostream>
#include<list>
using namespace std;

namespace code
{
    template<class T, class Container = list<T>>
    class Queue
    {
    public:
        Queue() {}
        size_t size() {return q.size();}
        bool empty() {return q.empty();}  
        void push(const T& x = T()) {q.push_back(x);}
        void pop() {q.pop_front();}  
        T& front(){return q.front();}
        T& back(){return q.back();}
        const T& front()const{return q.front();}
        const T& back()const{return q.back();}

    private:
        Container q;
    };
}

//OJ测试接口: 用栈实现队列
// T peek() {return q.front();}   
// T pop() {T ret; return (ret = q.front(),q.pop_front(),ret);}   
// T peek() {return q.front();}  